package com.woniu.util;

import com.jcraft.jsch.*;

import java.io.ByteArrayInputStream;
import java.io.IOException;
/**
 * @Author zhaoj
 * @Date 2025/6/10 19:40
 * @Description TODO
 **/
public class SSHConnection {
    String host = "47.109.89.37";
    int port = 22222;
    public void setConnection() throws JSchException {
        final JSch jSch = new JSch();
        jSch.setKnownHosts(new ByteArrayInputStream(host.getBytes()));
        jSch.addIdentity("src/main/resources/id_rsa");
        final Session session = jSch.getSession("root", host, port);
        session.setConfig("StrictHostKeyChecking", "no");
        session.connect(3000);
    }
}
